﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Commonlib;
namespace DAL
{
    public class BulletinDAL
    {
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public void Add(Albon.Model.BulletinMessage bulletin)
        {
            SqlParameter[] parameters =new SqlParameter[] {
				new SqlParameter("@ID", bulletin.ID),
				new SqlParameter("@title", bulletin.title),
				new SqlParameter("@content", bulletin.content),
				new SqlParameter("@active", bulletin.active)
            };
            SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnectionString, CommandType.StoredProcedure, "p_bulletinadd", parameters);
        }

        //根据查询条件返回信息
        public DataTable getBulletin(string limit)
        {
            string cmdstr = "select * from BulletinMessage where  "+limit;
            return SqlHelper.ExecuteDataSet(SqlHelper.SqlConnectionString, CommandType.Text, cmdstr, null).Tables[0];
        }
    }
}
